#
# Makefile for dsniff
#
# Dug Song <dugsong@monkey.org>
#
# $Id: Makefile.in,v 1.23 2000/05/18 20:20:04 dugsong Exp $

srcdir          = @srcdir@
VPATH           = @srcdir@

install_prefix  =
prefix          = @prefix@
exec_prefix	= @exec_prefix@
sbindir         = @sbindir@
mandir		= @mandir@

CC	= @CC@
CFLAGS	= @CFLAGS@
LDFLAGS	= @LDFLAGS@

PCAPINC = @PCAPINC@
PCAPLIB = @PCAPLIB@

LNETINC = @LNETINC@
LNETLIB = @LNETLIB@

NIDSINC	= @NIDSINC@
NIDSLIB	= @NIDSLIB@

DBINC	= @DBINC@
DBLIB	= @DBLIB@

X11INC	= @X_CFLAGS@
X11LIB	= @X_LIBS@ @X_PRE_LIBS@ -lXmu -lX11 @X_EXTRA_LIBS@

INCS	= $(NIDSINC) $(PCAPINC) $(LNETINC) $(DBINC) @MD5INC@ $(X11INC)
LIBS	= $(NIDSLIB) $(PCAPLIB) $(LNETLIB) @LIBS@

INSTALL	= @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA	= @INSTALL_DATA@

HDRS	= asn1.h base64.h hex.h rpc.h tcp_raw.h decode.h options.h record.h \
	  trigger.h version.h

SRCS	= asn1.c base64.c hex.c rpc.c tcp_raw.c trigger.c record.c dsniff.c \
	  decode.c decode_aim.c decode_citrix.c decode_cvs.c decode_ftp.c \
	  decode_hex.c decode_http.c decode_icq.c decode_imap.c decode_irc.c \
	  decode_ldap.c decode_mmxp.c decode_mountd.c decode_napster.c \
	  decode_nntp.c decode_oracle.c decode_ospf.c decode_pcanywhere.c \
	  decode_pop.c decode_portmap.c decode_postgresql.c decode_rip.c \
	  decode_rlogin.c decode_smb.c decode_sniffer.c decode_snmp.c \
	  decode_socks.c decode_telnet.c decode_yppasswd.c decode_x11.c

OBJS =  $(SRCS:.c=.o)

PROGS	= dsniff arpredirect macof mailsnarf tcpkill tcpnice urlsnarf @WEBSPY@

.c.o:
	$(CC) $(CFLAGS) -I. $(INCS) -c $(srcdir)/$*.c

all: $(PROGS)

dsniff: $(HDRS) $(SRCS) $(OBJS) @LIBOBJS@
	$(CC) $(LDFLAGS) -o $@ $(OBJS) @LIBOBJS@ $(DBLIB) $(LIBS)

arpredirect: arpredirect.o arp.o @LIBOBJS@
	$(CC) $(LDFLAGS) -o $@ arpredirect.o arp.o @LIBOBJS@ $(LIBS)

macof: macof.o @LIBOBJS@
	$(CC) $(LDFLAGS) -o $@ macof.o @LIBOBJS@ $(LIBS)

mailsnarf: mailsnarf.o
	$(CC) $(LDFLAGS) -o $@ mailsnarf.o $(LIBS)

tcpkill: tcpkill.o
	$(CC) $(LDFLAGS) -o $@ tcpkill.o $(LIBS)

tcpnice: tcpnice.o
	$(CC) $(LDFLAGS) -o $@ tcpnice.o $(LIBS)

urlsnarf: urlsnarf.o base64.o
	$(CC) $(LDFLAGS) -o $@ urlsnarf.o base64.o $(LIBS)

webspy: webspy.o base64.o remote.o
	$(CC) $(LDFLAGS) -o $@ webspy.o base64.o remote.o $(X11LIB) $(LIBS)

dirname.o: $(srcdir)/missing/dirname.c
	$(CC) $(CFLAGS) -I. $(INCS) -c $(srcdir)/missing/dirname.c

err.o: $(srcdir)/missing/err.c
	$(CC) $(CFLAGS) -I. $(INCS) -c $(srcdir)/missing/err.c

ethers.o: $(srcdir)/missing/ethers.c
	$(CC) $(CFLAGS) -I. $(INCS) -c $(srcdir)/missing/ethers.c

md5.o: $(srcdir)/missing/md5.c
	$(CC) $(CFLAGS) -I. $(INCS) -c $(srcdir)/missing/md5.c

strlcat.o: $(srcdir)/missing/strlcat.c
	$(CC) $(CFLAGS) -I. $(INCS) -c $(srcdir)/missing/strlcat.c

strlcpy.o: $(srcdir)/missing/strlcpy.c
	$(CC) $(CFLAGS) -I. $(INCS) -c $(srcdir)/missing/strlcpy.c

install:
	$(INSTALL) -d $(install_prefix)$(sbindir)
	$(INSTALL_PROGRAM) -m 755 $(PROGS) $(install_prefix)$(sbindir)
	$(INSTALL) -d $(install_prefix)$(mandir)/man8
	$(INSTALL_DATA) *.8 $(install_prefix)$(mandir)/man8

clean:
	rm -f *.o *~ $(PROGS)

distclean: clean
	rm -f Makefile config.h \
	      config.cache config.log config.status confdefs.h

# EOF
